package com.zhiwang.xiaoqu.mvp.model.response

import com.google.gson.annotations.SerializedName
import com.zhiwang.xiaoqu.mvp.model.*


data class LoginResponse(var token: String)


data class WithDrawItem(
    var num: String,
    @SerializedName("img")
    var tagUrl: String
)

data class UpdateCheck(
    @SerializedName("apk_version")
    var version: Int = 0,
    @SerializedName("apk_path")
    var url: String,
    /**
     * 0可选更新，1强制更新
     */
    @SerializedName("apk_isforceupdate")
    var forceUpdate: Int = 0,
    @SerializedName("apk_md5")
    var md5: String,
    @SerializedName("apk_size")
    var size: Long = 0,
    @SerializedName("version_name")
    var versionName: String?,
    @SerializedName("version_log")
    var updateLog: String? = ""
)


data class MessageBody(var list: List<Message>)

/**
 * "receiver": "30003",
"title": "test",
"content": "etstestest",
"status": "0",
"create_at": "2019-09-17 09:59:28"
 */
data class Message(
    var receiver: String,
    var title: String,
    var content: String,
    var status: String,
    var time: String
) {
    fun setHasRead() {
        status = "10"
    }

    val hasRead get() = status == "10"
}


data class WithDrawRecordBody(
    @SerializedName("total")
    var total: Int,
    @SerializedName("list")
    var data: List<WithDrawRecord>,
    var hasmore: Int,
    var page: Int
)


data class BindBody(var bind: Int, var token: String, var openid: String)

//"create_at": "2019-01-11 16:19:36",
//"payment": "weixin",
//"payment_txt": "微信提现",
//"money": "100.00",
//"status": "0",
//"status_txt": "待审核"
data class WithDrawRecord(
    @SerializedName("create_at")
    var date: String,
    @SerializedName("payment")
    var type: String,//weixin ,alipay
    @SerializedName("payment_txt")
    var typeText: String,
    var money: String,
    var status: Int,
    @SerializedName("status_txt")
    var statusText: String,
    @SerializedName("status_msg")
    var failMsg: String
)

data class FriendHeaderInfo constructor(
    var friendNum: String,
    var validFriendNum: String,
    var friendMoneyContributed: String
) :
    FriendModel {

    override fun type() = TYPE_FRIEND_HEADER

    override fun friendNumber() = friendNum

    override fun validFriendNumber() = validFriendNum

    override fun friendContributionSum() = friendMoneyContributed


    /*****************/

    override fun imageUrl() = null

    override fun nickName() = null

    override fun singleFriendBenefit() = null

    override fun singleFriendContribution() = null

}

class FriendBanner : FriendModel {
    override fun friendNumber() = null
    override fun validFriendNumber() = null
    override fun friendContributionSum() = null
    override fun imageUrl() = null
    override fun nickName() = null
    override fun singleFriendBenefit() = null
    override fun singleFriendContribution() = null
    override fun type() = TYPE_FRIEND_BANNER
}


/*title*/
class FriendTitle : FriendModel {
    override fun friendNumber() = null
    override fun validFriendNumber() = null
    override fun friendContributionSum() = null
    override fun imageUrl() = null
    override fun nickName() = null
    override fun singleFriendBenefit() = null
    override fun singleFriendContribution() = null
    override fun type() = TYPE_FRIEND_TITLE
}

/**
 *  "userid": "30003",
"username": "趣友30003",
"avatar": "/static/images/avatar.png",
"allreward": 0,
"gognxian": 0
 */

data class FriendItem constructor(
    var userid: String,
    var username: String,
    var avatar: String,
    @SerializedName("allreward")
    var friendContribution: String,
    @SerializedName("gognxian")
    var contribution: String
) :
    FriendModel {

    override fun type() = TYPE_FRIEND_ITEM

    override fun friendNumber() = null

    override fun validFriendNumber() = null

    override fun friendContributionSum() = null

    /*********************/

    override fun imageUrl() = avatar

    override fun nickName() = username

    override fun singleFriendBenefit() = friendContribution.plus("元")

    override fun singleFriendContribution() = "+".plus(contribution).plus("元")
}


/**
 *  "txt1": "小趣姐",
"txt2": "企业QQ：123456789",
"txt3": "在线时间：10:00 - 18:00",
"qq": "123456789"
 */
data class QQServiceInfo(
    @SerializedName("txt1")
    var serviceName: String,
    @SerializedName("txt2")
    var serviceQQDesc: String,
    @SerializedName("txt3")
    var serviceDutyTimeDesc: String,
    @SerializedName("qq")
    var serviceQQ: String
)

/**
 * "gold_z": null,
"today_income": 0,
"regbag": 0
 */
data class MyUserInfo(
    @SerializedName("gold_z")
    var income: String?,
    @SerializedName("today_income")
    var todayIncome: String?,
    @SerializedName("regbag")
    var redPacketIncome: String?
)

data class About(
    @SerializedName("txt1")
    var serviceName: String,
    @SerializedName("txt2")
    var serviceQQDesc: String,
    @SerializedName("txt3")
    var serviceDutyTimeDesc: String
)

data class MoneyDetailBody(
    var total: Int,
    var list: List<MoneyDetailItem>,
    var page: Int,
    var hasmore: Int
)


/**
 *  "type": "8",
"number": "-500000",
"cost_text": "申请提现50元, 手续费1元, 实际到账49元",
"date": "2019-09-18 15:04:32"
 */
data class MoneyDetailItem(
    var type: Int,
    var number: Int,
    var cost_text: String,
    var date: String
)

data class IndexUserInfo(
    @SerializedName("today_income")
    var balance: String?,
    @SerializedName("gold_z")
    var profit: String
)